<?php
    header ( "Content-type:text/html;charset=utf-8" );
    $conn = mysqli_connect('localhost','root','root','xiaomi') or die('数据库连接失败');
    // $conn->set_charset('utf8');

    $user = $_POST['username'];
    $pass = $_POST['password'];
 	
    $sql = "insert into student(id,name,password) 
                values (null,'{$user}' ,'{$pass}')";
    $result=mysqli_query($conn,$sql) or die(mysqli_error($conn));
    // echo("注册成功！！！<br/><a href='index.html'>点击登录</a>") 
    mysqli_close($conn);  
    // echo("注册成功！！！");  
    if ($result == 1) {
        echo "1"; //表示注册成功
    } else {
        echo "0"; //表示注册失败
    }
?>